package com.mushan.springmvc01rr.Controller;


import com.mushan.springmvc01rr.bean.Person;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RequestTestController {



    @RequestMapping("/handle01")
    public String handle1(String username, String password,String cellphone,boolean agreement){
        System.out.println(username);
        System.out.println(password);
        System.out.println(cellphone);
        System.out.println(agreement);
        return "ok111111111111111111111111111111111111111";
    }


    //@RequestParam注解 明确指定获取哪个参数，带有required属性,为false为非必须携带
    @RequestMapping("/handle02")
    public String handle2(@RequestParam("username") String un,
                          @RequestParam("password") String pw,
                          String cellphone,
                          @RequestParam(value = "agreement", required = false) boolean am){
        System.out.println(un);
        System.out.println(pw);
        System.out.println(cellphone);
        System.out.println(am);
        return "ok22222222222222222222222222222222222222";
    }
    //pojo
    @RequestMapping("/handle03")
    public String handle3(Person person){
        System.out.println(person);
        return "封装成Person对象=====>"+person;
    }
    @RequestMapping("/handle04")
    public String handle4(Person person){
        System.out.println(person);
        return "ok";
    }
}
